package com.zhoug.imageloader3.wrap;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;

import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.resource.gif.GifDrawable;

import java.io.File;

import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RawRes;

/**
 * RequestManager包装类
 *
 * @Author 35574
 * @Date 2021/9/7
 * @Description
 */
public class RequestManagerWrap {
    private RequestManager mRequestManager;
    private Object mModel;//图片地址

    private RequestManagerWrap(@NonNull RequestManager requestManager) {
        mRequestManager = requestManager;
    }

    public static RequestManagerWrap create(@NonNull RequestManager requestManager) {
        return new RequestManagerWrap(requestManager);
    }

    public RequestBuilderWrap<Bitmap> asBitmap() {
        return RequestBuilderWrap.create(mRequestManager.asBitmap());
    }

    public RequestBuilderWrap<File> asFile() {
        return RequestBuilderWrap.create(mRequestManager.asFile());
    }

    public RequestBuilderWrap<GifDrawable> asGif() {
        return RequestBuilderWrap.create(mRequestManager.asGif());
    }

    public RequestBuilderWrap<Drawable> asDrawable() {
        return RequestBuilderWrap.create(mRequestManager.asDrawable());
    }


    public RequestBuilderWrap<Drawable> load(String string) {
        return RequestBuilderWrap.create(mRequestManager.load(string));
    }

    public RequestBuilderWrap<Drawable> load(Uri uri) {
        return RequestBuilderWrap.create(mRequestManager.load(uri));
    }

    public RequestBuilderWrap<Drawable> load(Bitmap bitmap) {
        return RequestBuilderWrap.create(mRequestManager.load(bitmap));
    }

    public RequestBuilderWrap<Drawable> load(Drawable drawable) {
        return RequestBuilderWrap.create(mRequestManager.load(drawable));
    }

    public RequestBuilderWrap<Drawable> load(File file) {
        return RequestBuilderWrap.create(mRequestManager.load(file));
    }

    public RequestBuilderWrap<Drawable> load(Object model) {
        return RequestBuilderWrap.create(mRequestManager.load(model));
    }

    public RequestBuilderWrap<Drawable> load(byte[] model) {
        return RequestBuilderWrap.create(mRequestManager.load(model));
    }

    public RequestBuilderWrap<Drawable> load(@RawRes @DrawableRes @Nullable Integer resourceId) {
        return RequestBuilderWrap.create(mRequestManager.load(resourceId));
    }

    public RequestBuilderWrap<File> download(Object model) {
        return RequestBuilderWrap.create(mRequestManager.download(model));
    }

    public RequestBuilderWrap<File> downloadOnly() {
        return RequestBuilderWrap.create(mRequestManager.downloadOnly());
    }


}
